﻿using Autofac;
using System.Reflection;

namespace DeZhen.CollaborationPlatform.WebApi.Configurations
{
    public class AutofacModuleRegister : Autofac.Module
    {
        protected override void Load(Autofac.ContainerBuilder builder)
        {
            Assembly iserviceAssembly = Assembly.Load("DeZhen.CollaborationPlatform.IService");
            Assembly serviceAssembly = Assembly.Load("DeZhen.CollaborationPlatform.Service");
            Assembly irepositroyAssembly = Assembly.Load("DeZhen.CollaborationPlatform.IRepository");
            Assembly repositoryAssembly = Assembly.Load("DeZhen.CollaborationPlatform.Repository");

            builder.RegisterAssemblyTypes(serviceAssembly, serviceAssembly).AsImplementedInterfaces();
            builder.RegisterAssemblyTypes(repositoryAssembly, repositoryAssembly).AsImplementedInterfaces();
        }
    }
}
